package com.zhuoshi.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhuoshi.entity.Unit;
import com.zhuoshi.entity.UnitCustom;
import com.zhuoshi.mapper.UnitMapper;
import com.zhuoshi.service.UnitService;

@Service("unitService")
@Transactional
public class UnitServiceImpl implements UnitService{
	
	@Autowired
	private UnitMapper unitMapper;
	//查询所有单元
	public List<UnitCustom> selectAllUnitLiu(String unumber) {
		return unitMapper.selectAllUnitLiu(unumber);
	}
	
	//通过楼栋id查看所有单元
	public List<Unit> selectUnitByComplexIdLiu(Integer complexid) {	
		return unitMapper.selectUnitByComplexIdLiu(complexid);
	}
	
	//添加单元
	public int addUnitConfirmLiu(Unit unit) {
		return unitMapper.insertSelective(unit);
	}
	
	//通过id删除单元
	public int deleteUnitById(int id) {
		return unitMapper.deleteByPrimaryKey(id);
	}
	
	//通过主键查询单元扩展类
	public UnitCustom selectUnitCustomById(int id) {
		return unitMapper.selectUnitCustomById(id);
	}
	
	//修改单元信息确认
	public int updateUnitConfirmLiu(Unit unit) {
		return unitMapper.updateUnitConfirmLiu(unit);
	}

}
